package com.szpx.service.yang.impl;

import com.szpx.entity.yang.YangDao;
import com.szpx.mapper.yang.ProductMapper;
import com.szpx.service.yang.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsServiceImpl implements ProductsService {
    private ProductMapper productMapper;

    @Autowired
    public ProductsServiceImpl(ProductMapper productMapper) {
        this.productMapper = productMapper;
    }

    @Override
    public List<YangDao> findAll() {
        return productMapper.findAll();
    }


    @Override
    public void addProduct(YangDao product) {
        productMapper.insert(product);
    }

    @Override
    public void updateProduct(YangDao product) {
        productMapper.update(product);
    }

    @Override
    public void deleteProduct(Long productId) {
        productMapper.delete(productId);
    }
}
